package com.iweb.service;

import com.iweb.mapper.CategoryMapper;
import com.iweb.pojo.Category;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class CategoryServiceImp implements CategoryService {

    @Autowired
    CategoryMapper categoryMapper;
    @Autowired
    UserService userService;
    @Override
    public Boolean insert(Category category) {
        return categoryMapper.insert(category)>0;
    }

    @Override
    public Boolean update(Category category) {
        return categoryMapper.updateCategory(category)>0;
    }

    @Override
    public List selectList(int userID) {
        int cid = userService.selectCidByUserID(userID);
        return categoryMapper.selectList(cid);
    }

    @Override
    public List selectAllCate() {
        return categoryMapper.selectAllCate();
    }


}
